package com.StarStudio.Config;


import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class RedissonConfig {

    @Bean
    public RedissonClient redissonClient(){
        //配置类
        Config config = new Config();
        //添加 Redis地址，添加单点地址，也可以使用config.userClusterServers()添加集群地址
//        config.useSingleServer().setAddress("redis://112.19.80.236:6139");  //开发环境配置
        config.useSingleServer().setAddress("redis://172.16.31.8:6139");  //生产环境配置
        //集群地址（目前使用单点地址）
//        config.useClusterServers().addNodeAddress("redis://172.16.31.8:6139","redis://172.16.31.9:6379");
        //创建客户端
        return Redisson.create(config);
    }

}
